<script type="text/javascript">
$(function() {
	$("#fm").submit(function(){
		if($("#srcPwd").val()==""||$("#newPwd").val()==""||$("#newPwd2").val()==""){
			new $.zui.Messager('输入信息不能为空！', {
	        	icon: 'cloud-upload',// 定义消息图标
	        	time:'1000'
	    	}).show();
			return false;
		}else if($("#newPwd").val()!=$("#newPwd2").val()){
			new $.zui.Messager('确认密码不一致！', {
	        	icon: 'cloud-upload',// 定义消息图标
	        	time:'1000'
	    	}).show();
			return false;
		}else if($("#newPwd").val().length<6){
			new $.zui.Messager('新密码不能小于6位', {
	        	icon: 'cloud-upload',// 定义消息图标
	        	time:'1000'
	    	}).show();
			return false;
		} else{
			return true;
		}
		
	})
});
var obj;
function pwdValidate(){
	var pwd = document.getElementById('srcPwd').value;

	var ajax = new XMLHttpRequest();
	//var obj ;
	ajax.onreadystatechange=function(){
		obj = ajax.responseText;
		if (ajax.readyState=4&&ajax.status==200){
			if(obj=="")
				document.getElementById('elem').innerHTML = "";
			else
				document.getElementById('elem').innerHTML = "密码不正确";
		}

	}
	ajax.open('post','user!pwdValidate');
	ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	ajax.send("password="+pwd);
}
</script>
<style>
form{
	margin-bottom: 30px;
}
</style>
   	<!-- 对话框HTML	修改密码	开始	-->
<div class="modal fade" id="updPwd">
  <div class="modal-dialog" style="width: 480px;">
    <div class="modal-content">
      <div class="myinfo" >
      	<h2><i>修改密码</i></h2>
      	<hr/>
      	<form id="fm" action="user!updatePwd" method="post">
		  <div class="form-group">
		    <label for="exampleInputAccount1">原密码</label>
		    <input type="password" class="form-control"placeholder="原密码" id="srcPwd" oninput="pwdValidate()">
			  <span style="color:red;font-weight: bold;font-size: 14px;"><i id="elem"></i></span>
		  </div>
		  <div class="form-group">
		    <label for="exampleInputPassword1">新密码</label>
		    <input type="password" class="form-control" placeholder="新密码" id="newPwd" name="password">
		  </div>
		  <div class="form-group">
		    <label for="exampleInputPassword1">确认密码</label>
		    <input type="password" class="form-control" placeholder="确认密码" id="newPwd2">
		  </div>
		  <button type="submit" class="btn btn-primary">修改密码</button>
		</form>
		
      </div>
    </div>
  </div>
</div>
    	<!-- 对话框HTML 修改密码	结束	-->